package cn.demo.cm.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.core.constant.SqlOperator;
import com.mybatisflex.core.query.SqlOperators;
import cn.demo.common.mybatisFlex.MyInsertListener;
import cn.demo.common.mybatisFlex.MyUpdateListener;
import cn.demo.common.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cn.demo.common.core.domain.BaseEntity;
/**
 * 轮播图对象 cm_carousel_img
 *
 * @author xtjun
 * @date 2024-06-04
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(value = "cm_carousel_img",onInsert = MyInsertListener.class,onUpdate = MyUpdateListener.class)
public class CmCarouselImg extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "主键")
    private String id;

    @Excel(name = "图片")
    @Schema(description = "图片")
    private String imgUrl;

    @Excel(name = "标题")
    @Schema(description = "标题")
    private String title;

    @Excel(name = "排序")
    @Schema(description = "排序")
    private Long sort;

    @Excel(name = "轮播图类型", dictType = "carousel_type")
    @Schema(description = "轮播图类型(字典:carousel_type)")
    private String type;

    @Excel(name = "文章id")
    @Schema(description = "文章id")
    private String contentId;

    @Excel(name = "活动id")
    @Schema(description = "活动id")
    private String actId;

    @Excel(name = "详情图")
    @Schema(description = "详情图")
    private String contentImg;

    @Excel(name = "部门id")
    @Schema(description = "部门id")
    private String deptId;

    // 自定义字段的 SQL 操作符
    @JsonIgnore
    public static final SqlOperators operators = new SqlOperators() {{
        set(CmCarouselImg::getTitle, SqlOperator.LIKE);
        set(CmCarouselImg::getSort, SqlOperator.EQUALS);
        set(CmCarouselImg::getType, SqlOperator.EQUALS);
        set(CmCarouselImg::getContentId, SqlOperator.EQUALS);
        set(CmCarouselImg::getDeptId, SqlOperator.EQUALS);
    }};
}
